package avicit.cbb.techclass.tabledefine.commtempletmanager.action.service.api;

import avicit.cbb.techclass.tabledefine.commtempletmanager.domain.CbbTempletCode;
import avicit.cbb.techclass.tabledefine.commtempletmanager.domain.CbbTempletField;
import avicit.cbb.techclass.tabledefine.commtempletmanager.domain.CbbTempletInfo;
import avicit.platform6.commons.utils.web.TreeNode;
import avicit.platform6.core.dao.Paging;
import avicit.platform6.core.jdbc.Page;
import avicit.platform6.core.rest.msg.ResponseMsg;
import avicit.platform6.core.restclient.RestClient;
import avicit.platform6.core.restclient.RestClientUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.stereotype.Component;

import java.io.ByteArrayOutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;

/**
 * @金航数码科技有限责任公司
 * @作者：jiam
 * @邮箱：jiam@avic-digital.com
 * @创建时间： 2020-12-31 14:52
 * @类说明：oa_travel_rbApi
 * @修改记录：
 */
@Component
public class CommTempletManagerServiceApi {


    /**
     * 服务编码
     */
    private static final String SERVICE_CODE = "filebasicmanager";

    private static final String BASE_PATH = "/api/avicit/cbb/techclass/tabledefine/commtempletmanager/action/rest/CommTempletManagerRest";

    @Autowired
    private RestClient restClient;

    /**
     * 获取列最大排序值
     *
     * @author 朱锋
     *
     * @return
     * @throws Exception
     *             ModelAndView
     * @throws
     */
    public int getMaxOrderNum(String templetId,String sysId) {
        String url = BASE_PATH + "/getMaxOrderNum";
        Map<String,Object> map = new HashMap<>();
        map.put("templetId",templetId);
        map.put("sysId",sysId);
        ResponseMsg<Integer> responseMsg = restClient.doPost(SERVICE_CODE,url, map, new ParameterizedTypeReference<ResponseMsg<Integer>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 删除参考模板字段信息操作
     *
     * @param ids
     * @param sysId
     * @return
     */
    public void deleteCommTempletField(String ids, String sysId) {
        String url = BASE_PATH + "/deleteCommTempletField";
        Map<String,Object> map = new HashMap<>();
        map.put("ids",ids);
        map.put("sysId",sysId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE,url, map, new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 根据模板id查询模板类型
     * @return templetId
     */
    public CbbTempletInfo getCommTempletInfoById(String templetId) {
        String url = BASE_PATH + "/getCommTempletInfoById" + templetId;
        ResponseMsg<CbbTempletInfo> responseMsg = restClient.doGet(SERVICE_CODE, url, new ParameterizedTypeReference<ResponseMsg<CbbTempletInfo>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    public void insertCommTempletFields(CbbTempletField[] cbbTempltFields, String sysId, String orgId, String deptId, String templetId) {
        String url = BASE_PATH + "/insertCommTempletFields";
        Map<String,Object> map = new HashMap<>();
        map.put("cbbTempltFields",cbbTempltFields);
        map.put("sysId",sysId);
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        map.put("templetId",templetId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE,url, map, new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 更新
     * @param updateCodeData
     * @param templetId
     * @param fieldId
     * @param sysId
     */
    public void updateCbbTempletFieldCodeArray(String updateCodeData, String templetId, String fieldId, String sysId) {
        Map<String,Object> map = new HashMap<>();
        String url = BASE_PATH + "/updateCbbTempletFieldCodeArray";
        map.put("updateCodeData",updateCodeData);
        map.put("templetId",templetId);
        map.put("fieldId",fieldId);
        map.put("sysId",sysId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE,url, map, new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 新增
     * @param inserCodeData
     * @param sysId
     * @param orgId
     * @param deptId
     * @param templetId
     * @param fieldId
     */
    public void insertCbbTempletFieldCodeArray(String inserCodeData, String sysId, String orgId, String deptId, String templetId, String fieldId) {
        Map<String,Object> map = new HashMap<>();
        String url = BASE_PATH + "/insertCbbTempletFieldCodeArray";
        map.put("inserCodeData",inserCodeData);
        map.put("sysId",sysId);
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        map.put("templetId",templetId);
        map.put("fieldId",fieldId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE,url, map, new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 删除参考模板代码维护信息操作
     *
     * @param deleteData
     * @param templetId
     * @param fieldId
     * @param sysId
     * @return
     */

    public void deletecommTempletCodeBydeleteData(String deleteData, String templetId, String fieldId, String sysId) {
        Map<String,Object> map = new HashMap<>();
        String url = BASE_PATH + "/deletecommTempletCodeBydeleteData";
        map.put("deleteData",deleteData);
        map.put("templetId",templetId);
        map.put("fieldId",fieldId);
        map.put("sysId",sysId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE,url, map, new ParameterizedTypeReference<ResponseMsg<Integer>>() {
        });
    }

    /**
     * 删除参考模板基本信息
     *
     * @param id
     * @param sysId
     * @return
     */
    public void deleteCommTempletInfoById(String id, String sysId) {
        Map<String,Object> map = new HashMap<>();
        String url = BASE_PATH + "/deleteCommTempletInfoById";
        map.put("id",id);
        map.put("sysId",sysId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE,url, map, new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }


    public String getTempltIdByTempltCode(String s, String sysId) {
        String url = BASE_PATH + "/getTempltIdByTempltCode";
        Map<String,Object> map = new HashMap<>();
        map.put("s",s);
        map.put("sysId",sysId);
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, map, new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    public Paging<CbbTempletField> getPageDetailList(Paging<CbbTempletField> page, Map<String, Object> parameter, String sysId) {
        String url = BASE_PATH + "/getPageDetailList";
        Map<String,Object> map = new HashMap<>();
        map.put("page",page);
        map.put("parameter",parameter);
        map.put("sysId",sysId);
        ResponseMsg<Paging<CbbTempletField>> responseMsg = restClient.doPost(SERVICE_CODE, url, map, new ParameterizedTypeReference<ResponseMsg<Paging<CbbTempletField>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    public int getParentNodeByParentId(String root) {
        String url = BASE_PATH + "/getParentNodeByParentId";
        ResponseMsg<Integer> responseMsg = restClient.doPost(SERVICE_CODE, url, root, new ParameterizedTypeReference<ResponseMsg<Integer>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 获取顶层节点
     * @param deptId
     */
    public void saveRootLantopArchiveTabClassVByType(String deptId) {
        String url = BASE_PATH + "/saveRootLantopArchiveTabClassVByType";
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, deptId, new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }



    /**
     * 根据orgId过滤过滤树节点
     * @param id
     * @param sysId
     * @param org_root
     * @return
     */
    public List<TreeNode> getCommTempletInfoTreeNodesRoot(String id, String sysId, String org_root) {
        String url = BASE_PATH + "/getCommTempletInfoTreeNodesRoot";
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("sysId",sysId);
        map.put("org_root",org_root);
        ResponseMsg<List<TreeNode>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<List<TreeNode>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 导出excel
     * @param headValue
     * @param os
     */
    public void exportExcelModule(List<String> headValue, ByteArrayOutputStream os) {
        String url = BASE_PATH + "/exportExcelModule";
        Map<String,Object> map = new HashMap<>();
        map.put("headValue",headValue);
        map.put("os",os);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 获取数据
     * @param templetId
     * @param orgId
     * @return
     */
    public List<Map<String, Object>> getCbbTempletFields(String templetId, String orgId) {
        String url = BASE_PATH + "/getCbbTempletFields";
        Map<String,Object> map = new HashMap<>();
        map.put("templetId",templetId);
        map.put("orgId",orgId);
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 构造文件名
     * @param templetId
     * @return
     */
    public String getFileName(String templetId) {
        String url = BASE_PATH + "/getFileName";
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, templetId , new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 分页结果集
     * @param page
     * @param parameter
     * @param sysId
     * @return
     */
    public Page<Map<String,Object>> getPageCodeDetailList(Paging<CbbTempletCode> page, Map<String, Object> parameter, String sysId) {
        String url = BASE_PATH + "/getPageCodeDetailList";
        Map<String,Object> map = new HashMap<>();
        map.put("page",page);
        map.put("parameter",parameter);
        map.put("sysId",sysId);
        ResponseMsg<Page<Map<String,Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<Page<Map<String,Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 获取系统节点同模板对应的字段信息
     * @param sysId
     * @param orgId
     * @param deptId
     * @param sysNodeId
     * @param tempModelType
     * @param nodeRows
     * @param treeType
     * @return
     */
    public String duplicateCheck(String sysId, String orgId, String deptId, String sysNodeId, String tempModelType, String nodeRows, String treeType) {
        String url = BASE_PATH + "/duplicateCheck";
        Map<String,Object> map = new HashMap<>();
        map.put("sysId",sysId);
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        map.put("sysNodeId",sysNodeId);
        map.put("tempModelType",tempModelType);
        map.put("nodeRows",nodeRows);
        map.put("treeType",treeType);
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    public void updateCommTempletInfo(CbbTempletInfo commTempletInfo) {
        String url = BASE_PATH + "/updateCommTempletInfo";
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, commTempletInfo , new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    public void updateDetailCommTempletFields(CbbTempletField[] cbbTempltFields, String sysId) {
        String url = BASE_PATH + "/updateDetailCommTempletFields";
        Map<String,Object> map = new HashMap<>();
        map.put("cbbTempltFields",cbbTempltFields);
        map.put("sysId",sysId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    public void insertCommTempletInfo(CbbTempletInfo commTempletInfo, String orgId, String deptId) {
        String url = BASE_PATH + "/insertCommTempletInfo";
        Map<String,Object> map = new HashMap<>();
        map.put("commTempletInfo",commTempletInfo);
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    public Paging<CbbTempletInfo> getPageList(Paging<CbbTempletInfo> page, Map<String, Object> parameter, String sysId) {
        String url = BASE_PATH + "/getPageList";
        Map<String,Object> map = new HashMap<>();
        map.put("page",page);
        map.put("parameter",parameter);
        map.put("sysId",sysId);
        ResponseMsg<Paging<CbbTempletInfo>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<Paging<CbbTempletInfo>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 更新
     * @param ccArray
     * @param templetId
     * @param sysId
     */
    public void updateCbbTempletFieldArray(CbbTempletField[] ccArray, String templetId, String sysId) {
        String url = BASE_PATH + "/updateCbbTempletFieldArray";
        Map<String,Object> map = new HashMap<>();
        map.put("ccArray",ccArray);
        map.put("templetId",templetId);
        map.put("sysId",sysId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 添加
     * @param ccArray
     * @param sysId
     * @param orgId
     * @param deptId
     * @param templetId
     */
    public void insertCbbTempletFieldArray(CbbTempletField[] ccArray, String sysId, String orgId, String deptId, String templetId) {
        String url = BASE_PATH + "/insertCbbTempletFieldArray";
        Map<String,Object> map = new HashMap<>();
        map.put("ccArray",ccArray);
        map.put("sysId",sysId);
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        map.put("templetId",templetId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 分页结果
     * @param page
     * @param parameter
     * @return
     */
    public Page<Map<String, Object>> getPageRuleDetailList(Paging<CbbTempletCode> page, Map<String, Object> parameter) {
        String url = BASE_PATH + "/getPageRuleDetailList";
        Map<String,Object> map = new HashMap<>();
        map.put("page",page);
        map.put("parameter",parameter);
        ResponseMsg<Page<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<Page<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    public boolean checkUnique(String name, String id, String sysId) {
        String url = BASE_PATH + "/checkUnique";
        Map<String,Object> map = new HashMap<>();
        map.put("name",name);
        map.put("id",id);
        map.put("sysId",sysId);
        ResponseMsg<Boolean> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<Boolean>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    public int checkCodeUnique(String lookupName, String lookupCode, String id, String tid, String fid, String sysId) {
        String url = BASE_PATH + "/checkCodeUnique";
        Map<String,Object> map = new HashMap<>();
        map.put("lookupName",lookupName);
        map.put("lookupCode",lookupCode);
        map.put("id",id);
        map.put("tid",tid);
        map.put("fid",fid);
        map.put("sysId",sysId);
        ResponseMsg<Integer> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<Integer>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 添加编码
     * @param cid
     * @param tid
     * @param fid
     * @param sysId
     * @param orgId
     * @param deptId
     */
    public void insertSysCode(String cid, String tid, String fid, String sysId, String orgId, String deptId) {
        String url = BASE_PATH + "/insertSysCode";
        Map<String,Object> map = new HashMap<>();
        map.put("cid",cid);
        map.put("tid",tid);
        map.put("fid",fid);
        map.put("sysId",sysId);
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    public Page<Map<String, Object>> getPageSysCodeSonList(Paging<CbbTempletCode> page, Map<String, Object> parameter, String sysId) {
        String url = BASE_PATH + "/getPageSysCodeSonList";
        Map<String,Object> map = new HashMap<>();
        map.put("page",page);
        map.put("parameter",parameter);
        map.put("sysId",sysId);
        ResponseMsg<Page<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<Page<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 根据orgId过滤过滤树节点
     * @param id
     * @param sysId
     * @param orgId
     * @return
     */
    public List<TreeNode> getCommTempletInfoTreeNodes(String id, String sysId, String orgId) {
        String url = BASE_PATH + "/getCommTempletInfoTreeNodes";
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("sysId",sysId);
        map.put("orgId",orgId);
        ResponseMsg<List<TreeNode>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<List<TreeNode>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 唯一性验证【名称唯一性验证】
     * @param name
     * @param tId
     * @param id
     * @param sysId
     * @return
     */
    public boolean checkFieldUnique(String name, String tId, String id, String sysId) {
        String url = BASE_PATH + "/checkFieldUnique";
        Map<String,Object> map = new HashMap<>();
        map.put("name",name);
        map.put("tId",tId);
        map.put("id",id);
        map.put("sysId",sysId);
        ResponseMsg<Boolean> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<Boolean>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 更新字段
     * @param commTempletField
     * @param sysId
     */
    public void updateDetailCommTempletField(CbbTempletField commTempletField, String sysId) {
        String url = BASE_PATH + "/updateDetailCommTempletField";
        Map<String,Object> map = new HashMap<>();
        map.put("commTempletField",commTempletField);
        map.put("sysId",sysId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 添加字段
     * @param commTempletField
     * @param sysId
     */
    public void insertCommTempletField(CbbTempletField commTempletField, String sysId, String orgId, String deptId) {
        String url = BASE_PATH + "/insertCommTempletField";
        Map<String,Object> map = new HashMap<>();
        map.put("commTempletField",commTempletField);
        map.put("sysId",sysId);
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 数据没有重复,调用添加方法
     * @param cbbTempltFields
     * @param sysId
     * @param orgId
     * @param deptId
     * @param templetId
     */
    public void insertCommTempletInitFields(CbbTempletField[] cbbTempltFields, String sysId, String orgId, String deptId, String templetId) {
        String url = BASE_PATH + "/insertCommTempletInitFields";
        Map<String,Object> map = new HashMap<>();
        map.put("cbbTempltFields",cbbTempltFields);
        map.put("sysId",sysId);
        map.put("orgId",orgId);
        map.put("deptId",deptId);
        map.put("templetId",templetId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<T>>() {
        });
    }

    /**
     * 参考模板字段信息跳转编辑取值
     *
     * @param id
     * @return
     * @throws Exception
     */
    public CbbTempletField getCommTempletFieldById(String id) {
        String url = BASE_PATH + "/getCommTempletFieldById";
        ResponseMsg<CbbTempletField> responseMsg = restClient.doPost(SERVICE_CODE, url, id , new ParameterizedTypeReference<ResponseMsg<CbbTempletField>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     * 获取平台通用代码信息
     * @param page
     * @param parameter
     * @param sysId
     * @return
     */
    public Page<Map<String, Object>> getPageSysCodeDetailList(Paging<CbbTempletCode> page, Map<String, Object> parameter, String sysId) {
        String url = BASE_PATH + "/getPageSysCodeDetailList";
        Map<String,Object> map = new HashMap<>();
        map.put("page",page);
        map.put("parameter",parameter);
        map.put("sysId",sysId);
        ResponseMsg<Page<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<Page<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     *根据组织ID获取列名
     * @param orgId
     * @param templetModelType
     * @param templetId
     * @return
     */
    public List<Map<String, Object>> getCommTempletFieldByTempletId(String orgId, String templetModelType, String templetId) {
        String url = BASE_PATH + "/getCommTempletFieldByTempletId";
        Map<String,Object> map = new HashMap<>();
        map.put("orgId",orgId);
        map.put("templetModelType",templetModelType);
        map.put("templetId",templetId);
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     *根据参考模板代码维护ID查询参考模板代码维护数据
     * @param id
     * @return
     */
    public CbbTempletCode getCommTempletCodeById(String id) {
        String url = BASE_PATH + "/getCommTempletCodeById";
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        ResponseMsg<CbbTempletCode> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<CbbTempletCode>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }

    /**
     *导出结构数据
     * @param headValue
     * @param head
     * @param datas
     * @param os
     */
    public void exportData(List<String> headValue, List<String> head, List<Map<String, Object>> datas, ByteArrayOutputStream os) {
        String url = BASE_PATH + "/exportData";
        Map<String,Object> map = new HashMap<>();
        map.put("headValue",headValue);
        map.put("head",head);
        map.put("datas",datas);
        map.put("os",os);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg>() {
        });
    }

    /**
     *解析 excel2003 文件
     * @param filePath
     * @return
     */
    public Map<String, Vector<Vector<String>>> readXls(String filePath) {
        String url = BASE_PATH + "/readXls";
        Map<String,Object> map = new HashMap<>();
        map.put("filePath",filePath);
        ResponseMsg<Map<String, Vector<Vector<String>>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<Map<String, Vector<Vector<String>>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     * 解析 excel2007 文件
     * @param filePath
     * @return
     */
    public Map<String, Vector<Vector<String>>> readXlsx(String filePath) {
        String url = BASE_PATH + "/readXlsx";
        Map<String,Object> map = new HashMap<>();
        map.put("filePath",filePath);
        ResponseMsg<Map<String, Vector<Vector<String>>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<Map<String, Vector<Vector<String>>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }


    /**
     * 判断excel文件数据合法性
     * @param datas
     * @param templetId
     */
    public void testExcel(Vector<Vector<String>> datas, String templetId) {
        String url = BASE_PATH + "/testExcel";
        Map<String,Object> map = new HashMap<>();
        map.put("datas",datas);
        map.put("templetId",templetId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg>() {
        });
    }


    /**
     *将excel中的数据添加到数据库中
     * @param datas
     * @param sysId
     * @param currentOrgId
     * @param currentDeptId
     * @param templetId
     */
    public void insertFromExcel(Vector<Vector<String>> datas, String sysId, String currentOrgId, String currentDeptId, String templetId) {
        String url = BASE_PATH + "/insertFromExcel";
        Map<String,Object> map = new HashMap<>();
        map.put("datas",datas);
        map.put("sysId",sysId);
        map.put("currentOrgId",currentOrgId);
        map.put("currentDeptId",currentDeptId);
        map.put("templetId",templetId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg>() {
        });
    }

    /**
     * 初始化字段维护导入判断excel文件数据合法性
     * @param datas
     * @param templetId
     */
    public void initFieldTestExcel(Vector<Vector<String>> datas, String templetId) {
        String url = BASE_PATH + "/initFieldTestExcel";
        Map<String,Object> map = new HashMap<>();
        map.put("datas",datas);
        map.put("templetId",templetId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg>() {
        });
    }

    /**
     * 初始化字段维护导入将excel中的数据添加到数据库中
     * @param datas
     * @param sysId
     * @param currentOrgId
     * @param currentDeptId
     * @param templetId
     */
    public void initFieldInsertFromExcel(Vector<Vector<String>> datas, String sysId, String currentOrgId, String currentDeptId, String templetId) {
        String url = BASE_PATH + "/initFieldInsertFromExcel";
        Map<String,Object> map = new HashMap<>();
        map.put("datas",datas);
        map.put("sysId",sysId);
        map.put("currentOrgId",currentOrgId);
        map.put("currentDeptId",currentDeptId);
        map.put("templetId",templetId);
        ResponseMsg responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg>() {
        });
    }

    /**
     *根据参考模板类型信息获得当前组织的参考模板信息和根组织的参考模板信息
     * @param sysId
     * @param orgId
     * @param tempModelType
     * @return
     */
    public List<Map<String, Object>> getCommTempletByTempModelType(String sysId, String orgId, String tempModelType) {
        String url = BASE_PATH + "/getCommTempletByTempModelType";
        Map<String,Object> map = new HashMap<>();
        map.put("sysId",sysId);
        map.put("orgId",orgId);
        map.put("tempModelType",tempModelType);
        ResponseMsg<List<Map<String, Object>>> responseMsg = restClient.doPost(SERVICE_CODE, url, map , new ParameterizedTypeReference<ResponseMsg<List<Map<String, Object>>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }
}
